﻿using Accouting804.ViewModels.AccountViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Transactions;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace Accouting804.Views
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class AccountItemDetailPage : ContentPage
    {
        SingleAccoutViewModel viewModel { get; set; }
        public AccountItemDetailPage(SingleAccoutViewModel singleAccoutViewModel)
        {
            viewModel = singleAccoutViewModel;
            InitializeComponent();
            BindingContext = viewModel;
        }

        private async void ToolbarItem_Clicked(object sender, EventArgs e)
        {
            var currentItem = viewModel.Item;
            MessagingCenter.Send(this, "UpdateAccountItem", currentItem);
            await Navigation.PopModalAsync();



            var tp = this.time_picker;



        }

        

        private async void delete_btn_Clicked(object sender, EventArgs e)
        {


            await viewModel.AccountDataStore.DeleteItemAsync(viewModel.Item.AutoId.ToString());
            await Navigation.PopModalAsync();
            //await Navigation.PopModalAsync();
            //await Navigation.PopModalAsync();
        }

        private async void cancel_btn_Clicked(object sender, EventArgs e)
        {
            await Navigation.PopModalAsync();
        }
    }
}